#include <cstdio>

const int Limit_Size = 1000 + 10;

int s[ Limit_Size ], N, M;

void init( )
{
    int i;
    for ( i = 0; i < N; i++ )
        s[ i ] = i + 1;
}

void swap( int a, int b )
{
    int tmp = s[ a ];
    s[ a ] = s[ b ];
    s[ b ] = tmp;
}

void sort( int p )
{
    int i, j, k;
    for ( i = p; i < N - 1; i++ )
    {
        k = i;
        for ( j = i + 1; j < N; j++ )
            if ( s[ k ] > s[ j ] )
                k = j;
        swap( i, k );
    }
}

void work( )
{
    int i, j, k, p;
    void print( );
    for ( i = 1; i < M; i++ )
    {
        for ( j = N - 1; j > 0; j-- )
            if ( s[ j ] > s[ j - 1 ] )
                break;
        p = j;
        j--;
        for ( k = N - 1; k > j; k-- )
            if ( s[ k ] < s[ p ] && s[ k ] > s[ j ] )
                p = k;
        swap( j, p );
        sort( j + 1 );
    }
}

void print( )
{
    int i;
    printf("%d", s[ 0 ]);
    for ( i = 1; i < N; i++ )
        printf(" %d", s[ i ]);
    printf("\n");
}

int main( )
{
    while ( scanf("%d%d", &N, &M) != EOF )
    {
        init( );
        work( );
        print( );
    }
    return 0;
}
